package com.lucun.es_transaction.controller;
import com.lucun.es_transaction.config.RolePermission;
import com.lucun.es_transaction.entity.Orders;
import com.lucun.es_transaction.service.OrdersService;
import com.lucun.es_transaction.util.AuthorityUtil;
import com.lucun.es_transaction.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    OrdersService service;
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/insert")//商品订单添加/下单
    public JsonResult<?> insertSelective(@RequestBody Orders orders, HttpServletRequest request){
        return service.insert(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/selectByPrimaryKey")//订单查询/id
    public JsonResult<?> selectByPrimaryKey(@RequestBody Orders orders, HttpServletRequest request){
        return service.selectByPrimaryKey(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/selectByUserId")//订单查询/用户
    public JsonResult<?> selectByUserId(@RequestBody Orders orders, HttpServletRequest request){
        return service.selectByUserId(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/selectBystatus")//订单查询/待发货订单
    public JsonResult<?> selectBystatus(@RequestBody Orders orders, HttpServletRequest request){
        return service.selectBystatus(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/selectBypayment")//订单查询/待付款订单
    public JsonResult<?> selectBypayment(@RequestBody Orders orders, HttpServletRequest request){
        return service.selectBypayment(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/selectByreceiving")//订单查询/待付款订单
    public JsonResult<?> selectByreceiving(@RequestBody Orders orders, HttpServletRequest request){
        return service.selectByreceiving(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/deleteByPrimaryKey")//订单记录删除
    public JsonResult<?> deleteByPrimaryKey(@RequestBody Orders orders, HttpServletRequest request){
        return service.deleteByPrimaryKey(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/updateByPrimaryKeySelective")//订单地址修改
    public JsonResult<?> updateByPrimaryKeySelective(@RequestBody Orders orders, HttpServletRequest request){
        return service.updateByPrimaryKeySelective(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/updateBypayment")//订单支付状态修改
    public JsonResult<?> updateBypayment(@RequestBody Orders orders, HttpServletRequest request){
        return service.updateBypayment(orders,request);
    }
    @RolePermission(role = AuthorityUtil.SECOND)
    @RequestMapping("/updateBystatus")//订单发货状态修改
    public JsonResult<?> updateBystatus(@RequestBody Orders orders, HttpServletRequest request){
        return service.updateBystatus(orders,request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/updateByreceiving")//订单收货状态修改
    public JsonResult<?> updateByreceiving(@RequestBody Orders orders, HttpServletRequest request){
        return service.updateByreceiving(orders,request);
    }
}
